﻿using System;
using System.Windows.Forms;

using desktop.Entity;
using desktop.Igrica;


namespace desktop.Prodavac.GUI
{
    public partial class ProdavacForm : Form
    {
        bool _askToClose = true;

        public ProdavacForm(Uposlenik u)
        {
            InitializeComponent();

            TrenutniUposlenik = u;

            // TODO(kklisura): Dodati Spol u Uposlenik-u
            Text = "Prodavac | Dobrodosao " + u.Ime + "-e";
        }

        #region Properties 

        public Uposlenik TrenutniUposlenik
        {
            get;
            private set;
        }

        #endregion

        #region GUI Handlers

        private void ProdavacForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!_askToClose)
            {
                return;
            }

            DialogResult result = MessageBox.Show("Da li zaista zelite izaci iz programa?", "Exit", MessageBoxButtons.YesNo);

            if (result == DialogResult.No)
            {
                e.Cancel = true;
            }
        }

        private void ProdavacForm_Load(object sender, EventArgs e)
        {
        }

        private void izadjiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void odjaviSeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _askToClose = false;
            this.DialogResult = DialogResult.OK;
            Close();
        }

        private void igricaToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            SlovaricaForm sf = new SlovaricaForm();
            sf.ShowDialog();
        }

        #endregion
    }
}
